package org.lc.stk.model.question.attrs;

import org.hibernate.annotations.Comment;

import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.Table;

@Entity
@Table(name = "system_question_types")
@Comment("系统内置题型")
public class SystemQuestionType extends QuestionType {

    public enum Code {
        SINGLE_CHOICE(1, "单项选择"),
        MULTIPLE_CHOICE(2, "多项选择"),
        TRUE_FALSE(3, "判断"),
        FILL_BLANK(4, "填空");  // 新增填空题类型

        private final int value;
        private final String description;

        Code(int value, String description) {
            this.value = value;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }
    }

    @Enumerated(EnumType.STRING)
    @Comment("题型代码")
    private Code code;

    protected SystemQuestionType() {
        setType(Type.SYSTEM);
    }

    public SystemQuestionType(String name, Code code) {
        this();
        setName(name);
        this.code = code;
    }

    public Code getCode() {
        return code;
    }

    protected void setCode(Code code) {
        this.code = code;
    }
}
